home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / IM_Install3.adf / piarc.LZH / eroder.rexx < prev    next >
OS/2 REXX Batch file  |  1992-02-29  |  2KB  |  94 lines

  1. /*
  2.  * ERODER.rexx   ( calls the erode command )
  3.  *
  4.  *  Written by: Barry Chalmers and Ben Williams
  5.  * Last Update: January 17th, 1992
  6.  *    Revision: 1.01
  7.  *         For: Black Belt Systems image processing series IM, IM F/c, and IP.
  8.  */
  9.  
  10. /*
  11.  * open rexxsupport.library -- needed for some functions
  12.  */
  13. if ~show('L',"rexxsupport.library") then do
  14.   if addlib('rexxsupport.library',0,-30,0) then do
  15.       /* everything's ok */
  16.     end;
  17.   else do
  18.     say 'We Have A Library Problem, Unable To Load "rexxsupport.library"';
  19.     say 'Cannot operate this module without the library - sorry!';
  20.     exit 10;
  21.     end;
  22.   end;
  23.  
  24. prtnme = 'IP_Port'; /* assume Image Professional */
  25. if show('P','IP_Port') = 0 then do
  26.   if show('P','IM_Port') = 0 then do
  27.     say "Can't find image processor's ARexx port!!!"; /* not running? */
  28.     say "This script requires IP, IM or IM F/c to run!";
  29.     exit(20);
  30.     end;
  31.   else do
  32.     prtnme = 'IM_Port';
  33.     end;
  34.   end;
  35. address(prtnme);
  36.  
  37.   /*
  38.    * This code attempts to read a file called "picmdpath" from REXX:
  39.    * If it can't find it, the script will assume that the commands
  40.    * associated with this PI Module are in "c:". If the file exists,
  41.    * the script will look in the path that is specified in the file.
  42.    * If you create this file, you MUST put a complete, correct path
  43.    * in it; if the commands are in a sub-directory, you have to put
  44.    * the trailing slash on the path (like, device:dir/).
  45.    * 
  46.    */
  47.   cmdpath = 'c:';
  48.   if open(fhandle,'rexx:picmdpath','read') then  /* open the file */
  49.     do
  50.       cmdpath = readln(fhandle);
  51.       call close(fhandle);  /* close the file    */
  52.     end
  53.  
  54. 'tofront';
  55.  
  56. options results;
  57. 'gadgets "Brightness Erode","","Brightness Dilate",""';
  58. emode = result-1;
  59. options;
  60. if emode < 0 then do
  61.   address;
  62.   exit 0;
  63.   end
  64.  
  65.  
  66. 'fchide';
  67. options results;
  68. 'askprop "Cell size:" 6 2 20';
  69. edge = result;
  70. options;
  71.  
  72. 'fcshow';
  73. 'backuptoundo';
  74. 'area';
  75.  
  76. options results;
  77. 'jackin';
  78. jack = result;
  79. 'current';
  80. bufdata = result;
  81. options;
  82. parse var bufdata bname ',' bnum ',' brest
  83.  
  84. 'lockimage '||bnum;
  85. address command cmdpath||'erode '||jack||' '||edge||' '||emode;
  86. 'unlockimage '||bnum;
  87. address(prtnme);
  88.  
  89. 'redraw';
  90.  
  91. address;
  92.  
  93. exit 0;
  94.